package com.b2b.util;


import com.b2b.model.CompanyFinancialFlowDto;

import com.b2b.model.entity.company.CompanyFinancialFlow;
import com.b2b.service.CompanyFinancialFlowService;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class CompanyFinancialFlowUtil {
    private final CompanyFinancialFlowService companyFinancialFlowService;

    public CompanyFinancialFlowUtil(CompanyFinancialFlowService companyFinancialFlowService){
        this.companyFinancialFlowService = companyFinancialFlowService;
    }


    public Integer add(CompanyFinancialFlow companyFinancialFlow){
        Integer count = companyFinancialFlowService.insert(companyFinancialFlow);

        return count;
    }

    public List<CompanyFinancialFlow> getMy(Integer companyId){
        CompanyFinancialFlow companyFinancialFlow = new CompanyFinancialFlow();
        companyFinancialFlow.setCompanyId(companyId);
        List<CompanyFinancialFlow> companyFinancialFlowList = companyFinancialFlowService.select(companyFinancialFlow);

        return companyFinancialFlowList;

    }
    public CompanyFinancialFlow getCompanyFinancialFlow(CompanyFinancialFlowDto companyFinancialFlowDto){
        CompanyFinancialFlow companyFinancialFlow = new CompanyFinancialFlow();

        companyFinancialFlow.setFinancialId(companyFinancialFlowDto.getFinancialId());
        companyFinancialFlow.setFinancialTime(companyFinancialFlowDto.getFinancialTime());
        companyFinancialFlow.setFinancialSum(companyFinancialFlowDto.getFinancialSum());
        companyFinancialFlow.setFinancialType(companyFinancialFlowDto.getFinancialType());
        companyFinancialFlow.setContext(companyFinancialFlowDto.getContext());

        return companyFinancialFlow;
    }
}
